package com.qiuzhiyi.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.li.widget.TagImageView;
import com.qiuzhiyi.R;
import com.qiuzhiyi.item.FaTieImgItem;

/**
 * Author: Li
 * Date: 2017/11/28 0028
 * Description: 发帖时候图片
 */

public class FaTieImgAdapter extends BaseQuickAdapter<FaTieImgItem,BaseViewHolder> {
    public FaTieImgAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, FaTieImgItem item) {
        if (item.getUri()!=null) {
            ((TagImageView) helper.getView(R.id.img)).setImageURI(item.getUri());
            ((TagImageView) helper.getView(R.id.img)).setScaleType(ImageView.ScaleType.CENTER_CROP);
        }else {
            ((TagImageView) helper.getView(R.id.img)).setImageResource(R.drawable.tianjiafatie);
            ((TagImageView) helper.getView(R.id.img)).setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        }
    }
}
